package com.cross.filter;

import com.cross.core.AbstractWriter;
import com.cross.core.Writer;

@SuppressWarnings("unchecked")
public abstract class AbstractWriterFilter extends AbstractWriter implements
		Filter {

	private Writer writer;

	public AbstractWriterFilter(Writer writer) {
		this.writer = writer;
	}

	protected void writeRow() {
		if (writer.available()) {
			try {
				writer.write(filte(currentRow));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	@Override
	public void close() {
		writer.close();
	}
}
